#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <queue>

using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int N = 3e5 + 10;
const int INF = 1e9 + 10;

int n, q, newval;
LL A[N];
unordered_map<LL, LL> mp;

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n;
    newval = INF;
    for(int i = 1; i <= n; i ++) cin >> A[i];

    cin >> q;

    int op, x, y;
    while(q --){
        cin >> op;

        if(op == 1){
            cin >> x;
            mp.clear();
            newval = x;
        }else if(op == 2){
            cin >> x >> y;
            if(newval != INF && !mp.count(x)){
                A[x] = newval;
                mp[x] = 1;
            }

            A[x] += y;
        }else{
            cin >> x;
            if(newval != INF && !mp.count(x)){
                A[x] = newval;
                mp[x] = 1;
            }

            cout << A[x] << '\n';
        }
    }


    return 0;
}